package ExceptionTest;


public class Test03 {
    public static void main(String[] args) {
        //类型转换异常--ClassCastException
        Animal a = new Dog();
//        Cat c = (Cat) a ;
        //纠错
        if (a instanceof Cat){
            Cat C = (Cat) a ;
        }
    }
}
class Animal{}
class Dog extends Animal{}
class Cat extends Animal{}

